# 导入redis数据库用于存放session
from redis import StrictRedis
class Config:
    # 开启DEBUG模式
    DEBUG = None
    # 设置秘钥
    SECRET_KEY = 'WkRORTcyV25uUkhTeXhncEJSbGc4ZG0zaHpKQVFHcE01ZjNlVDhBT2pvbnJ1R1lD'
    # 连接mysql的配置

    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/winfo'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/winfo'
    # SQLALCHEMY_TRACK_MODIFICATIONS = False
    # 设置session存储位置
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    # 对session信息进行签名
    SESSION_USE_SIGNER = True
    # 用flask自带的session设置过期时间
    PERMANENT_SESSION_LIFETIME = 86400


# 定义开发模式配置类
class DevelopmentConfig(Config):
    DEBUG = True


# 定义生产模式配置类
class ProductionConfig(Config):
    DEBUG = False

# 定义字典映射
config_dict = {
    'Product':ProductionConfig,
    'Development':DevelopmentConfig
}